import type { ReviewItemSaveUpdateParams } from './basic-settings-module.d'
import axiosReq from '@/utils/axios-req'
// API 基础路径
const BASE_URL = import.meta.env.VITE_APP_BASE_URL_LLY

// 评审项设置
/**
 * 评审项信息-列表
 */
export const getReviewItemList = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/itemInfo/list`,
    method: 'POST',
    data
  })
}

/**
 * 评审项信息-新增、修改
 */
export const postReviewItemSaveUpdate = (data: ReviewItemSaveUpdateParams) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/itemInfo/saveUpdate`,
    method: 'POST',
    data,
    showMsg: true
  })
}
/**
 * 评审项信息-查看
 */
export const getReviewItemView = (params: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/itemInfo/view`,
    method: 'GET',
    params
  })
}
/**
 * 评审项设置-删除
 */
export const postReviewItemRemove = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/itemInfo/remove`,
    method: 'POST',
    data,
    showMsg: true
  })
}

// 评审模板设置
/**
 * 评审模板-列表
 * @param data {
    "name":"",
    "pageNo":1,
    "pageSize":10
}
 * @returns
 */
export const postReviewTemplateList = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/templateInfo/list`,
    method: 'POST',
    data
  })
}

/**
 * 评审模板-新增修改
 * @param data
 * @returns
 */
export const postReviewTemplateSaveUpdate = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/templateInfo/saveUpdate`,
    method: 'POST',
    data,
    showMsg: true
  })
}
/**
 * 评审模板-查看
 * @returns
 */
export const getReviewTemplateView = (params: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/templateInfo/view`,
    method: 'GET',
    params
  })
}

/**
 * 评审项信息-删除
 */

export const postTemplateInfoRemove = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/templateInfo/remove`,
    method: 'POST',
    data,
    showMsg: true
  })
}

/**
 * 评分点信息-树维护
 * @param data  {
 * "itemId": "38",
 *  "pointTree" : []
 * }
 * @returns
 */
export const pointInfoSaveUpdate = (data: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/pointInfo/saveUpdate`,
    method: 'POST',
    data,
    showMsg: true
  })
}

/**
 * 评分点信息-树维护-查看
 * @param data {itemId=38}
 * @returns
 */
export const pointInfoView = (params: any) => {
  return axiosReq({
    baseURL: BASE_URL,
    url: `/cloud/pbgl/pointInfo/view`,
    method: 'GET',
    params
  })
}
